<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <title><?= $title?>-支付</title>
    <script type="text/javascript">
    // top.location.href += '&paid=' + Math.random();
        // function getPayResult(){
        //     $.get('?r=guide/payResult')
        // }
        //调用微信JS api 支付
        function jsApiCall()
        {
            WeixinJSBridge.invoke(
                'getBrandWCPayRequest',
                <?php echo $jsApiParameters; ?>,
                function(res){
                    WeixinJSBridge.log(res.err_msg);
                    if(res.err_msg=='get_brand_wcpay_request:ok'){
                    	alert('支付成功！');
                        top.location.href = top.location.href.replace(/&code=/, '&paid=');
                    }else{
                    	alert('支付失败：'+res.err_code+res.err_desc+res.err_msg);
                    }
                }
            );
        }
        function callpay()
        {
            if (typeof WeixinJSBridge == "undefined"){
                if( document.addEventListener ){
                    document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
                }else if (document.attachEvent){
                    document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                    document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
                }
            }else{
                jsApiCall();
            }
        }
    </script>
</head>
<body>
<body>
<?php $this->beginBody() ?>
<div align="center">
    重庆抗战遗址博物馆 » <br/>
    <h3><?= $title?></h3>
    <br /><br /><br />
    <p style="font-size: 13px;">本数字导游内容需要付费观看，该笔订单支付金额为<span style="color:#f00;font-size:50px"><?php echo $payAmount?>元</span>钱</b></p><br/><br/>
    <button style="width:210px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer;  color:white;  font-size:16px;" type="button" onclick="callpay()" >立即支付</button>
    <br />
    <?php if(isset($_GET['paid'])): ?>
    <p style="font-size: 13px;">如果你已支付，请勿重复支付，刷新试试！</p>
    <button style="width:210px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer;  color:white;  font-size:16px;" type="button" onclick="top.location.reload()" >刷新</button>
    <?php endif;?>
</div>
<?php $this->endBody() ?>
</body>
</html>